<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="UTF-8">
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <title>Document</title>
   <style>
      body{
         display: grid;
         place-items: center;
      }
      div{
         width: 400px;
         height: 300px;
         background: yellowgreen;
         filter: brightness(50%);
      }
      span{
         width: 30px;
         height: 20px;
         background: yellowgreen;
         border-radius: 4px;
      }
   </style>
</head>
<body>
   <div class="media"></div>
   <p>亮度:<input type="range"><span>50</span></p>
</body>
<script>
   var media=document.querySelector('.media')
   var span=document.querySelector('span')
   var slider=document.querySelector('input')

   slider.oninput=function(){
      media.style.filter=`brightness(${slider.value}%)`
      span.textContent=slider.value;
   }
   

</script>
</html>